package com.ruoyi.buss.hourse.service.impl;

import java.util.List;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.buss.hourse.mapper.DataHoursePriceMapper;
import com.ruoyi.buss.hourse.domain.DataHoursePrice;
import com.ruoyi.buss.hourse.service.IDataHoursePriceService;
import com.ruoyi.system.api.model.LoginUser;

/**
 * 抵押品小区评估价格Service业务层处理
 * 
 * @author sxy
 * @date 2022-04-08
 */
@Service
public class DataHoursePriceServiceImpl implements IDataHoursePriceService 
{
    @Autowired
    private DataHoursePriceMapper dataHoursePriceMapper;

    @Autowired
    private TokenService tokenService;

    /**
     * 查询抵押品小区评估价格
     * 
     * @param id 抵押品小区评估价格ID
     * @return 抵押品小区评估价格
     */
    @Override
    public DataHoursePrice selectDataHoursePriceById(Integer id)
    {
        return dataHoursePriceMapper.selectDataHoursePriceById(id);
    }

    /**
     * 查询抵押品小区评估价格列表
     * 
     * @param dataHoursePrice 抵押品小区评估价格
     * @return 抵押品小区评估价格
     */
    @Override
    public List<DataHoursePrice> selectDataHoursePriceList(DataHoursePrice dataHoursePrice)
    {
        return dataHoursePriceMapper.selectDataHoursePriceList(dataHoursePrice);
    }

    /**
     * 新增抵押品小区评估价格
     * 
     * @param dataHoursePrice 抵押品小区评估价格
     * @return 结果
     */
    @Override
    public int insertDataHoursePrice(DataHoursePrice dataHoursePrice)
    {
        LoginUser userInfo = tokenService.getLoginUser();
        dataHoursePrice.setCreateTime(DateUtils.getNowDate());
        dataHoursePrice.setCreateUser(userInfo.getUsername());
        dataHoursePrice.setDelFlag(0);
        return dataHoursePriceMapper.insertDataHoursePrice(dataHoursePrice);
    }

    /**
     * 修改抵押品小区评估价格
     * 
     * @param dataHoursePrice 抵押品小区评估价格
     * @return 结果
     */
    @Override
    public int updateDataHoursePrice(DataHoursePrice dataHoursePrice)
    {
        LoginUser userInfo = tokenService.getLoginUser();
        dataHoursePrice.setUpdateTime(DateUtils.getNowDate());
        dataHoursePrice.setUpdateUser(userInfo.getUsername());
        return dataHoursePriceMapper.updateDataHoursePrice(dataHoursePrice);
    }

    /**
     * 批量删除抵押品小区评估价格
     * 
     * @param ids 需要删除的抵押品小区评估价格ID
     * @return 结果
     */
    @Override
    public int deleteDataHoursePriceByIds(Integer[] ids)
    {
        return dataHoursePriceMapper.deleteDataHoursePriceByIds(ids);
    }

    /**
     * 删除抵押品小区评估价格信息
     * 
     * @param id 抵押品小区评估价格ID
     * @return 结果
     */
    @Override
    public int deleteDataHoursePriceById(Integer id)
    {
        return dataHoursePriceMapper.deleteDataHoursePriceById(id);
    }
}
